using System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ACM.cmsarea08;
using ACM.cmsarea08.Core;
using ACM.cmsarea08.Controls;
using ACM.cmsarea08.Administration;

using ICSharpCode.SharpZipLib.Checksums;
using ICSharpCode.SharpZipLib.Zip.Compression;
using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
using ICSharpCode.SharpZipLib.Zip;
using ICSharpCode.SharpZipLib.GZip;
using ICSharpCode.SharpZipLib.BZip2;
using ICSharpCode.SharpZipLib.Tar;

namespace ACM.cmsarea08.Administration.Core {
	public partial class gesUPanel :  BaseDGridPage {
		private ACM.cmsarea08.Administration.Core.DBClass dclass = new cmsarea08.Administration.Core.DBClass();
		private ACM.cmsarea08.Function.TextClass tlc = new ACM.cmsarea08.Function.TextClass();
		
		
		override protected void OnInit(EventArgs e)
		{
			InitializeComponent();
			base.OnInit(e);
			
		}

		private void InitializeComponent()
		{
			if(this.Master is ACM.cmsarea08.Administration.Core.ListerPrivate) {
				((ACM.cmsarea08.Administration.Core.ListerPrivate)this.Master).adm_button.Visible=false;
			}
			
			this.Load += new System.EventHandler(this.Page_Load);
		}
	
		private void Page_Load(object o , EventArgs e) {
			if(Request.Params["rolesList"]!=null)
				LoadRuoli();
		}
		private void SetXmlResponse() {
			Response.Clear();
			Response.ContentType = "text/xml";		
			Response.Write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
		}
		private void LoadRuoli() {
			SetXmlResponse();
			string query = "SELECT ruolo,dipendenze FROM itant_ruoli where enabled='1' ;";
			DataSet ds = dclass.ExecuteDataset(query);
			if(ds==null) return;
			string xml = "<dati>";
			foreach(DataRow dr in ds.Tables[0].Rows) {
				xml+="<dato>";
				xml+="<nome>" + dr[0] + "</nome>";
				xml+="<dipe>" + dr[1] + "</dipe>";
				xml+="</dato>";
			}
			xml += "</dati>";
			Response.Write(xml);
			//Response.End();
			
		}
	}
	
}
